package com.zcb.qingshoudan.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zcb.qingshoudan.R;
import com.zcb.qingshoudan.entity.GatheringCountVoDetails;

import java.util.List;

/**
 * Created by ZCB on 2016/12/2.
 */

public class GatheringCountAdapter extends RecyclerView.Adapter<GatheringCountAdapter.ViewHolder> {

    private List<GatheringCountVoDetails> gatheringCountVoDetailses;

    public GatheringCountAdapter(List<GatheringCountVoDetails> gatheringCountVoDetailses) {
        this.gatheringCountVoDetailses = gatheringCountVoDetailses;
    }



    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_gathering_count,parent,false);
        ViewHolder vh=new ViewHolder(view);
        return vh;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tvCount.setText(gatheringCountVoDetailses.get(position).getOrdnum()+"单");
        holder.tvDate.setText("日期:"+gatheringCountVoDetailses.get(position).getPaytime());
        holder.tvMoney.setText("￥"+gatheringCountVoDetailses.get(position).getPrice()+"元");
    }

    @Override
    public int getItemCount() {
        return gatheringCountVoDetailses.size();
    }
    public class ViewHolder extends RecyclerView.ViewHolder{

        public ViewHolder(View itemView) {
            super(itemView);
            this.tvMoney= (TextView) itemView.findViewById(R.id.gathering_count_money);
            this.tvDate= (TextView) itemView.findViewById(R.id.gathering_count_date);
            this.tvCount= (TextView) itemView.findViewById(R.id.gathering_count_count);
        }


        public TextView tvCount;
        public TextView tvDate;
        public TextView tvMoney;
    }
}
